use super::types::RedisValue;

/// Storage engine trait
pub trait StorageEngine: Send + Sync {
    /// Get a value by key
    fn get(&self, key: &str) -> Option<RedisValue>;

    /// Set a value with optional TTL
    fn set(&self, key: String, value: RedisValue, ttl: Option<u64>) -> bool;

    /// Delete a key
    fn del(&self, key: &str) -> bool;

    /// Check if a key exists
    fn exists(&self, key: &str) -> bool;

    /// Get all keys matching a pattern
    fn keys(&self, pattern: &str) -> Vec<String>;

    /// Get the type of a key
    fn r#type(&self, key: &str) -> Option<String>;

    /// Get TTL of a key (-1 if no expiration, -2 if key doesn't exist)
    fn ttl(&self, key: &str) -> Option<i64>;

    /// Set expiration time for a key
    fn expire(&self, key: &str, seconds: u64) -> bool;

    /// Remove expiration from a key
    fn persist(&self, key: &str) -> bool;
}